package com.kylinhunter.ch.knowledgebase;

import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
 
import com.kylinhunter.ch.plugin.knowledgebase.ui.AddFileWindow;
import com.kylinhunter.ch.plugin.knowledgebase.ui.AddFileWindowAction;
import com.kylinhunter.exception.KHException;
import com.test.common.JFrameWithDesktop;
import com.test.common.TestTools;

public class AddFileWindowTest {
	static JFrameWithDesktop jFrameWithDesktop=TestTools.getAframeWithDesktop(); 
	static int i=0;
	static AddFileWindow  addFileWindow=new AddFileWindow("id","file") ;
	static AddFileWindowAction addFileWindowDo=new AddFileWindowAction();	 
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		addFileWindowDo=EasyMock.createMock(AddFileWindowAction.class);		
		
		addFileWindow.setAddFileWindowAction(addFileWindowDo);
		addFileWindowDo.addFile(addFileWindow);
		addFileWindowDo.addFile(addFileWindow);
		EasyMock.expectLastCall().andThrow(new KHException("","","","") ).times(2);
		EasyMock.replay(addFileWindowDo);
	}

	@Before 
	public void setUp() throws Exception {
	 

	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public final void testAddFileWindow() {



		addFileWindow.setWindows_id(addFileWindow.getTitle());

		jFrameWithDesktop.addDeskTopPanelInternalFrame(addFileWindow);

		jFrameWithDesktop.setVisible(true);
		 
		TestTools.sleep();
	}





}
